﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class PlatForm_ExportExpertQuestion : System.Web.UI.Page
{
	private PX.Question.Component clsQuestionComp = new PX.Question.Component();

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
		{
			Grv.DataSource = clsQuestionComp.QueryAll();
			Grv.DataKeyNames = new string[] { "ID" };
			Grv.DataBind();
		}
	}

	protected override void OnInit(EventArgs e)
	{
		clsQuestionComp.page = Page;

		base.OnInit(e);

		Grv.RowDataBound += new GridViewRowEventHandler(Grv_RowDataBound);
	}

	void Grv_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		int nQuestionID = 0;
		GridView gv = new GridView();

		gv = (GridView)sender;

		if (e.Row.RowIndex >= 0)
		{
			e.Row.Cells[1].Controls.Clear();
			HyperLink aLink = new HyperLink();

			nQuestionID = Convert.ToInt32(gv.DataKeys[e.Row.RowIndex].Value);

			aLink.Text = e.Row.Cells[1].Text;
			//aLink.NavigateUrl = "../ShowImageContent.aspx?FileID=" + ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
			aLink.NavigateUrl = "QuestionDetail.aspx?QuestionID=" + gv.DataKeys[e.Row.RowIndex].Value.ToString();
			aLink.Target = "_blank";

			e.Row.Cells[1].Controls.Add(aLink);
		}
	}
}